type User1 = {
  name: string;
  age: number;
};

const user: User1 = {
  age: 30,
  name: "John",
};

function doSomething<T>(param: T): T {
  return param;
}
const res = doSomething<User1>(user);

// swap

function Swap<T, U>(tuple: [T, U]): [U, T] {
  // firstParams = secondParams;
  // secondParams = firstParams;
  // console.log(tuple[1], tuple[0]);
  return [tuple[1], tuple[0]];
}

// 箭头函数版本
// const swap1 = <FirstPa, ScondPa>([firstValue, secondValue]: [
//   FirstPa,
//   ScondPa
// ]) => [secondValue, firstValue];

const test1 = Swap(["hello", 5]);
console.log(test1);
